import org.junit.Test;
import util.DBUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class MyTest1 {
    @Test
    public  void testConn() throws SQLException {
        Connection conn = DBUtil.getConnection();
        String sql = "select * from stu";
        PreparedStatement pstmt = conn.prepareStatement(sql);
        ResultSet rs = pstmt.executeQuery();

        //
        while (rs.next()){
            System.out.println(rs.getInt("id" )+
                    ","+rs.getString("name")+","+rs.getInt("age")+","+rs.getString("hiredate"));
        }
    }
}
